Skip to content

Add --restart-from-slice and global --skip-slices for partial Z alignment restarts#24

Open
msayr wants to merge 1 commit into
z_alignfrom
codex/add-flag-to-specify-restart-slice-in-alignment
Open

Add --restart-from-slice and global --skip-slices for partial Z alignment restarts#24
msayr wants to merge 1 commit into
z_alignfrom
codex/add-flag-to-specify-restart-slice-in-alignment

Conversation

@msayr

@msayr msayr commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Allow resuming Z alignment from a specific global slice to avoid recomputing earlier good slices when a single problematic slice needs rework.
  • Ensure user-provided global skip slices are honored across datasets without manual per-dataset editing of configs.

Description

  • Added helper functions in emalign/align_dataset_z.py: _dataset_global_bounds, _zero_store_from_slice, _prepare_partial_restart, and _apply_skip_slices to compute dataset Z ranges, clear outputs, reset MongoDB progress, and map global skip indices to per-dataset local ignore_slices_flow entries.
  • Extended the align_dataset_z function signature and CLI with --restart-from-slice and --skip-slices, wired these options into startup logic so --restart-from-slice clears destination stores (full, mask, downsampled) from the given global slice onward and resets progress/docs/z_aligned for affected stacks.
  • Mapped global --skip-slices into each dataset config by adding the corresponding local indices to ignore_slices_flow so flow computation will skip those slices automatically.
  • Kept existing --wipe-progress behavior and integrated partial-restart logic to only clear/modify progress for stacks that overlap the requested restart slice; changes are confined to emalign/align_dataset_z.py.

Testing

  • Ran python -m py_compile emalign/align_dataset_z.py which succeeded without syntax errors.
  • Attempted CUDA_VISIBLE_DEVICES=0 PYTHONPATH=. python -m emalign.align_dataset_z --help but the run was blocked by the environment failing to import cv2 (libGL.so.1 missing), so full CLI execution/interactive help could not be exercised here.

Codex Task

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c3645fcec9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

for global_z in skip_slices:
if global_start <= global_z < global_end:
local_z = int(local_z_min) + global_z - global_start
existing.add(local_z)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Guard against skipping the first flow slice

When --skip-slices names the first slice whose flow is computed for a stack (the stack start for referenced/downstream stacks, or the second local slice for a self-aligned root stack), this adds that local index to ignore_slices_flow. The ignore branch in _compute_flow synthesizes a skipped flow with flows[-1], so with no prior flow it raises IndexError before any progress can be made. Please reject/remap these boundary skips or make the flow code handle an initial skipped slice.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant